<?php
require_once 'dataCenter.php';
require_once 'MJDMTask.php';
require_once 'common.php';

log_action("In Page : ".__FILE__);

if(!isset($_SESSION)){session_start();}

$tasklist = GetUserTasksInfo()->Show();
// Printing tasklist
$tasklist_outputs = "<ul class='tasks mt25'>\n";

foreach ($tasklist as $task) {
	$id = $task->id;
	$task_name = $task->name;
	$task_point =$task->points;
	$task_dueDate = $task->dueDate;
	$task_tag =$task->tag;
	$task_url = $task->url;

	$tasklist_outputs .="\t\t\t<li>\n";
	$tasklist_outputs .="\t\t\t\t<label class='checkbox'><input type='checkbox'></label>\n";
	$tasklist_outputs .="\t\t\t\t<span class='nostar'></span>\n";
	$tasklist_outputs .="\t\t\t\t<p class='task-content'>\n";
	$tasklist_outputs .="\t\t\t\t<span class='task-name'>$task_name</span>\n";
	$tasklist_outputs .="\t\t\t\t<span class='tag'>$task_tag</span>\n";
	$tasklist_outputs .="\t\t\t\t<span class='due-date'>$task_dueDate</span>\n";
	if(strlen($task_url) > 0 )
	{
		$tasklist_outputs .="\t\t\t\t<a href='$task_url' target='blank'>Task link</a>\n";
	}
	$tasklist_outputs .="\t\t\t\t</p>\n";
	$tasklist_outputs .="\t\t\t\t<span class='coin'>$task_point</span>\n";


	$tasklist_outputs .="\t\t\t\t<div class='operation'>\n";
	$tasklist_outputs .="\t\t\t\t\t<input type='button' value='delete' class='small red' />\n";
	$tasklist_outputs .="\t\t\t\t\t<input type='button' value='edit' class='small blue' />\n";
	$tasklist_outputs .="\t\t\t\t\t<input type='hidden' value='$id' class='hidden_id' />\n";
	$tasklist_outputs .="\t\t\t\t</div>\n";
	$tasklist_outputs .="\t\t\t</li>\n";
}
$tasklist_outputs .= "\t\t</ul>\n";

echo $tasklist_outputs;
